﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Web Camera</title>
	<link rel="stylesheet" href="jquery/css/jquery.ui.all.css" />
	<link rel="stylesheet" href="css/common.css" />
	<script src="jquery/jquery-1.9.1.min.js"></script>
	<script src="jquery/jquery.ui.core.js"></script>
	<script src="jquery/jquery.ui.widget.js"></script>
	<script src="jquery/jquery.ui.mouse.js"></script>
	<script src="jquery/jquery.ui.slider.js"></script>
	<script src="jquery/json2.js"></script>
	<script src="js/network.js"></script>
	<script src="js/common.js"></script>

</head>
<script  type="text/javascript"> 
document.write(GetLanguagePathStr());
</script> 

<style type="text/css">
.StorageDiv{
	background:#1c1d22;
	left:0px;
	right:0px;
	height:300px;
}

.DivLable{
	text-align:left;
	line-height: 23px;
	font-family:arial;
	font-style:regular;
	font-size:16px;
	color:#ffffff;
	height:23px;
	cursor: pointer;
}


.DivInputAtLoacalRecord{
	width:280px;
	float:left;
}

.DivInputIpv4Param{
	width:50px;
	float:left;
}

#id_txtLocalrecordpath{
	width:160px;
	float:left;
}

.StoragetxtNature{
	width:160px;
	float:left;
}

.StoragetxtAction{
	width:320px;
	float:left;
}

</style> 


<body>   
<div class="StorageDiv" style="min-width:800px;">
	<div style="height:100%;margin:auto;width:800px;">	
		<div style="clear:both;height:15px;"></div>
		
		<div class="DivCheckBox" style="float:left;"id="id_StorageOffRecord"><script>InitCheckBox('id_StorageOffRecord','true')</script></div>
		<div class="DivLable" style="float:left;margin-left:10px;" id="id_txtStorageOffRecord">Offline Record</div>
		
		<div class="DivCheckBox" style="float:left; margin-left:50px;"id="id_StorageAutoUpload"><script>InitCheckBox('id_StorageAutoUpload','true')</script></div>
		<div class="DivLable" style="float:left;margin-left:10px;" id="id_txtStorageAutoUpload">Auto Upload</div>
		<div style="clear:both;height:15px;"></div>
		
		<div class="DivLable StoragetxtNature" id="id_txtStorageSize">Size:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_StorageSize" value="admin"></input>
		<div style="clear:both;height:15px;"></div>
		
		<div class="DivLable StoragetxtNature" id="id_txtStorageUsed">Used:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_StorageUsed" value="admin"></input>
		<div style="clear:both;height:15px;"></div>
		
		<div class="DivLable StoragetxtNature" id="id_txtStorageAvailable">Available:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_StorageAvailable" value="admin"></input>
		<div style="clear:both;height:15px;"></div>
		
		<div class="DivButton" style="float:left;margin-left:200px;" id="id_StorageRefresh">Refresh</div>
		<div class="DivButton" style="float:left;margin-left:20px;" id="id_StorageFormat">Format</div>
		<div style="clear:both;height:15px;"></div>
		
		<div class="DivLable StoragetxtNature" id="id_txtStorageOverwrite">Overwrite:</div>
		<div style="float:left"> 
		<div class="ClassContentSelect" id="id_StorageOverwrite">On</div>
		<div class="DivContentSelectIco" id="id_StorageOverwrite_selectico"></div>
		<div style="clear:both"></div>
		<div class="ClassContentSelectOption" name="id_StorageOverwrite_option" style="margin-top:0px;" id="id_txtStorageOverwriteOn">On</div>
		<div class="ClassContentSelectOption" name="id_StorageOverwrite_option" style="margin-top:24px;" id="id_txtStorageOverwriteOff">Off</div>
		</div>
		<div class="DivLable StoragetxtAction" id="id_txtStorageAction" style="float:left;margin-left:10px;">Enable or Disable auto overwrite</div>
		<div style="clear:both;height:15px;"></div>
			
		<div class="DivButton" style="float:left;margin-left:300px;" id="id_StorageSubmit">Save</div>

		<div style="clear:both"></div>
	</div>
</div>
</body>   
<script  type="text/javascript"> 
//语言包初始化
function InitLang(){
	SetLang('id_txtStorageOffRecord',str_SDBreakRedord);
	SetLang('id_txtStorageAutoUpload',str_SDUp); 
	SetLang('id_txtStorageSize',str_SDCount);
	SetLang('id_txtStorageUsed',str_SDValiable);
	SetLang('id_txtStorageAvailable',str_SDNotValiable);
	SetLang('id_StorageRefresh',str_SDSelect);
	SetLang('id_StorageFormat',str_SDFormat);
	SetLang('id_txtStorageOverwrite',str_SDFull);
	SetLang('id_txtStorageAction',str_SDimformation);
	SetLang('id_txtStorageOverwriteOn',str_SDCricle);
	SetLang('id_txtStorageOverwriteOff',str_SDStop);
	SetLang('id_StorageSubmit',str_SDSave);
}
</script> 

<script  type="text/javascript"> 
function InitPageParam()
{
	
	var resp = $.sendMsg("QuerySDCardStat",null,"/ISAPI/Sdcard/QuerySDCardStat","POST");
	if(resp.success == false){
		alert("recv QuerySDCardStat msg fail");
		return;
	}
	var map = resp.data;
	//console.log( JSON.stringify(map));
	$("#id_StorageSize")[0].value =  parseInt(Number(map.totoalsizekbyte)/(1024)) + "(G)";
	$("#id_StorageUsed")[0].value = map.usedkbyte + "(M)";
	$("#id_StorageAvailable")[0].value = map.availablekbyte + "(M)";
	
	var resp = $.sendMsg("SDStorage",null,"/ISAPI/Sdcard/SDStorage","POST");
	if(resp.success == false){
		alert("recv SDStorage msg fail");
		return;
	}
	var map = resp.data;
	//console.log(JSON.stringify(map));
	SetSelectionOptID('id_StorageOverwrite',map.opertype);
}

function submit()
{

	/*var msg = [
				{"xtype":"opertype","text":"1"}
			];
	var resp = $.sendMsg("SDOperation",msg,"/ISAPI/Sdcard/SDOperation","PUT");
    console.log(JSON.stringify(msg));
	if(resp.success == false){
		alert("submit msg fail");
	}else{
		alert("设置成功");
	}*/	

	var strSDMode;
	if(GetSelectionVal('id_StorageOverwrite') == str_SDCricle){
		strSDMode = "0";
	}else{
		strSDMode = "1";
	}
	
	var msgback = [
					{"xtype":"opertype","text":strSDMode}
				];

	var resp = $.sendMsg("SDStorage",msgback,"/ISAPI/Sdcard/SDStorage","PUT");
    console.log(JSON.stringify(msgback));
	if(resp.success == false){
		alert("submit msg fail");
	}else{
		alert(str_SetSuccess);
	}	
}

function StorageRefresh(){
	InitPageParam();
}

function StorageFormat(){
	if (confirm(str_ConfirmContinue)==true){ 
		var msgback = [
					{"xtype":"opertype","text":'1'}
				];
		var resp = $.sendMsg("SDOperation",msgback,"/ISAPI/Sdcard/SDOperation","PUT");
		//console.log(JSON.stringify(msgback));
		if(resp.success == false){
			alert("submit msg fail");
		}else{
			alert(str_SetSuccess);
		}			
	}else{ 
		return false; 
	} 
}

$(function(){
	InitUdfSelect('id_StorageOverwrite');
	InitLang();
	InitPageParam();
	BindEvent('id_StorageSubmit','onmousedown',submit,null);
	BindEvent('id_StorageRefresh','onmousedown',StorageRefresh,null);
	BindEvent('id_StorageFormat','onmousedown',StorageFormat,null);
})

</script> 

</html>  